function slice(arr, start, end) {
    if (arr.length === 0) {
        return []
    }
    start = start || 0
    end = end || arr.length
    if (start > arr.length) {
        return []
    }
    if (start > end) {
        end = arr.length
    }
    const result = []
    for (var i = start; i < end; i++) {
        result.push(arr[i])
    }
    return result
}